----------------------------------Spell Variables--------------------------------------
SPELL.m_iSpellID = 602 -- Whatever value you want as long as it doesn't override any other spells' IDs.
SPELL.m_iRange = 240
SPELL.m_sName = "Defiled Soil"
SPELL.m_sToolTip =	[[To Do: Tooltip]]
SPELL.m_sIcon = "devin/blackbetty/spells/warrior/defiledsoil.jpg"
SPELL.m_iCoolDown = 8
SPELL.m_iManaCost = 50
SPELL.m_bRequiresTarget = false
SPELL.m_iSpellType = SPELLTYPE_MELEEDAMAGE
SPELL.m_bRecastWhileCasting = false

---------------------------------------------------------------------------------------

local range = 100
local weapondamage = 10

function SPELL:Cast( pl, target )
	print("Casted "..self.m_sName.."!")
		pl.InSpellAnimation = true
		pl:DoAnimationEvent(ACT_DI_ALYX_ANTLION)
		pl:EmitSound("devin/blackbetty/weapons/Flamestrike.wav", 100, 100)
		local whirlRadius = ents.FindInSphere(pl:GetPos(), 240)
		ParticleEffectAttach( "whirlwind", PATTACH_POINT_FOLLOW, pl, pl:LookupAttachment("anim_attachment_RH"))
		ParticleEffectAttach( "fire_hands_instacast", PATTACH_POINT_FOLLOW, pl, pl:LookupAttachment("anim_attachment_RH"))
		timer.Simple(0.45, function()
			for i, s in pairs(whirlRadius)do
				if(s and s:EntIndex() != pl:EntIndex() and s:IsPlayer() or s:IsNPC() or s:GetClass() == "npc_rpgdm")then
					local dmginfo = DamageInfo()
						dmginfo:SetDamage( 40 ) --50 damage
						dmginfo:SetDamageType( DMG_GENERIC ) --Bullet damage
						dmginfo:SetAttacker( pl ) --First player found gets credit
						dmginfo:SetDamageForce( Vector( 0, 0, 1000 ) ) --Launch upwards
					s:TakeDamageInfo( dmginfo ) 
					pl:EmitSound("devin/blackbetty/weapons/BloodBoil.wav", 150, 100)
					ParticleEffect( "pummel_hit", s:GetPos() + Vector(0, 0, 46) + (s:GetAngles():Forward()*6), Angle(0,0,0), pl )
					ParticleEffect( "player_blood", s:GetPos() + Vector(0, 0, 46) + (s:GetAngles():Forward()*6), Angle(0,0,0), pl )
				end
			end
		end)
		timer.Simple(0.8, function()
			pl.InSpellAnimation = false
			pl:SetNWBool("Casting", false)
			pl:SetNWBool("Casted", false)
		end)
	end





